import java.util.*;

public class Anothertest {
    public static void main(String[] args) {
        List<Student> list =new ArrayList<>();
        Student stu1=new Student();
        Student stu2=new Student();
        Student stu3=new Student();
        list.add(stu1);
        list.add(stu1);
        list.add(stu3);
        /*System.out.println(list.size());
        for(int i=0;i<list.size();i++)
        {
            System.out.println(list.get(i).getNo());
        }
        /*冒号后面是循环的东西，前面是东西的对象类型
        for (Student t:list) {
            System.out.println(t.getName());
        }
        list.remove(1);
        list.remove(stu1);
        Map<String,Student> map=new HashMap<>();
        map.put("a",stu1);
        map.put("b",stu2);
        map.put("c",stu3);
        map.put("d",stu3);
        /*keyset()是key的集合
        for (String key:map.keySet()) {
            System.out.println( map.get("key").getNo());
        }
        Set<Student> set=new HashSet<>();
        set.add(stu1);
        set.add(stu1);
        set.add(stu1);*/
        /*去重功能*/
        Set<Student> sets=new HashSet<>();
        for (Student student:list) {
            sets.add(student);
        }
        System.out.println(sets.size());
    }
}
class Student
{
    private String no;
    private String name;
    public Student(String no,String name)
    {
        this.no=no;
        this.name=name;
    }
    public Student()
    {

    }
    public String getName()
    {
        return name;
    }
    public String getNo()
    {
        return no;
    }
    public void setNo(String no)
    {
        this.no=no;
    }
    public void setName(String name)
    {
        this.name=name;
    }
}
